const path = require('path');

module.exports = {
	entry: './src/index.js',
	output: {
		filename: 'bundle.js',
		path: path.resolve(__dirname, 'dist')
	},
	module: {
		rules: [{
				test: /\.css$/,
				use: [{
						loader: 'style-loader'
					},
					{
						loader: 'css-loader'
					},
					{
						//针对loader的配置
						loader: 'px2rem-webpack-loader',
						options: {
							baseDpr: 2, // base device pixel ratio (default: 2)
							remUnit: 75, // rem unit value (default: 75)
							remPrecision: 6, // rem value precision (default: 6)
							forcePxComment: 'px', // force px comment (default: `px`)
							keepComment: 'no', // no transform value comment (default: `no`)
							remLimit: 1, // 不转换rem的最小px数，（default: 0）例如：设置为1时，1px不进行rem转换
						}
					}
				]
			},
			{
				test: /\.(woff|woff2|eot|ttf|otf)$/,
				use: [
					'file-loader'
				]
			},
			{
				test: /\.(png|svg|jpg|gif)$/,
				use: [
					'file-loader'
				]
			}
		]
	}
};
